import request from '@/utils/request'

// 查询车型管理列表
export function listVehicle(query) {
  return request({
    url: '/base/vehicle/list',
    method: 'get',
    params: query
  })
}

// 查询车型管理详细
export function getVehicle(id) {
  return request({
    url: '/base/vehicle/' + id,
    method: 'get'
  })
}
// 查询车辆型号列表
export function vehicleModelList() {
  return request({
    url: '/base/vehicle/vehicleModelList',
    method: 'get'
  })
}
// 查询车辆颜色
export function vehicleColorList(vehicleMode) {
  return request({
    url: '/base/vehicle/vehicleColorList/' +vehicleMode,
    method: 'get',
  })
}



// 新增车型管理
export function addVehicle(data) {
  return request({
    url: '/base/vehicle',
    method: 'post',
    data: data
  })
}

// 修改车型管理
export function updateVehicle(data) {
  return request({
    url: '/base/vehicle',
    method: 'put',
    data: data
  })
}


// 删除车型管理
export function delVehicle(id) {
  return request({
    url: '/base/vehicle/' + id,
    method: 'delete'
  })
}

// 导出车型管理
export function exportVehicle(query) {
  return request({
    url: '/base/vehicle/export',
    method: 'get',
    params: query
  })
}

// 上传附件
export function uploadVehicleImage(data) {
  return request({
    url: '/base/vehicle/uploadVehicleImage',
    method: 'post',
    data: data
  })
}

export function changeSaleStatus(id, saleStatus) {
  const data = {
    id,
    saleStatus
  }
  return request({
    url: '/base/vehicle/changeStatus',
    method: 'put',
    data: data
  })
}

